package org.jsola.hr.web;

import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.exception.ParamException;
import org.jsola.hr.dto.attendrule.AttendRuleAddDTO;
import org.jsola.hr.dto.attendrule.AttendRuleUpdateDTO;
import org.jsola.hr.query.AttendDepInfoTreeQuery;
import org.jsola.hr.query.AttendEmpInfoQuery;
import org.jsola.hr.query.AttendRuleQuery;
import org.jsola.hr.query.CheckStaffInAttendPlanQuery;
import org.jsola.hr.vo.*;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.user.core.TokenUser;
import org.jsola.user.core.UserContext;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * 考勤规则
 *
 * @author wxz
 */
@Api(tags = "hr-考勤规则")
public interface IAttendRuleControllerAPI {


    /**
     * 根据考勤规则ID查询考勤规则详情
     *
     * @param id 考勤规则ID
     * @return 勤规则详情
     */
    @ApiOperation(value="根据考勤规则ID查询考勤规则详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", dataType = "String", value = "考勤规则ID", paramType = "path")
    })
    Result<AttendRuleVO> findById(String id);

    /**
     * 新增考勤规则
     *
     * @param attendRuleAddDTO 考勤规则
     * @return true-保存成功,false-保存失败
     */
    @ApiOperation(value = "新增考勤规则")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendRuleAddDTO", dataType = "AttendRuleAddDTO", value = "考勤规则", paramType = "body")
    })
    Result<AttendPlanVO> save(AttendRuleAddDTO attendRuleAddDTO);


    /**
     * 修改考勤规则
     * @param attendRuleUpdateDTO 考勤规则
     * @return 更新数量
     */
    @ApiOperation(value = "修改考勤规则")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendRuleUpdateDTO", dataType = "AttendRuleUpdateDTO", value = "修改考勤规则", paramType = "body")
    })
    Result<Integer> update(AttendRuleUpdateDTO attendRuleUpdateDTO);


    /**
     * 分页查询考勤规则
     * @param attendRuleQuery 考勤规则查询参数
     * @return page
     */
    @ApiOperation(value="分页查询模板信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendRuleQuery", dataType = "AttendRuleQuery", value = "考勤规则查询参数", paramType = "query")
    })
    Result<Page<AttendRuleListVO>> page(AttendRuleQuery attendRuleQuery);


    /**
     * 校验人员或者部门中的人员是否已经在考勤规则中
     *
     * @param checkStaffInAttendPlanQuery 校验参数
     * @return CheckStaffInAttendPlanVO
     */
    @ApiOperation(value="校验人员或者部门中的人员是否已经在考勤规则中")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "checkStaffInAttendPlanQuery", dataType = "CheckStaffInAttendPlanQuery", value = "校验参数", paramType = "query")
    })
    Result<CheckStaffInAttendPlanVO> checkStaffInAttendPlan(CheckStaffInAttendPlanQuery checkStaffInAttendPlanQuery);

    /**
     * 查询部门(树)
     *
     * @param attendDepInfoTreeQuery 查询部门参数
     * @return 部门(树)
     */
    @ApiOperation(value="查询部门(树)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendDepInfoTreeQuery", dataType = "AttendDepInfoTreeQuery", value = "查询部门参数", paramType = "query")
    })
    Result<List<AttendDepInfoTreeVO>> selectDepInfoTree(AttendDepInfoTreeQuery attendDepInfoTreeQuery);

    /**
     * 查询部门下的人员
     *
     * @param attendEmpInfoQuery
     * @param siteId
     * @return
     */
    @ApiOperation(value="查询部门下的人员")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendEmpInfoQuery", dataType = "AttendEmpInfoQuery", value = "查询部门参数", paramType = "query")
    })
    Result<List<AttendEmpInfoVO>> selectEmpInfo(AttendEmpInfoQuery attendEmpInfoQuery, String siteId);

    /**
     * 删除单个考勤规则
     *
     * @param attendPlanId 考勤规则id
     * @return 删除数量
     */
    @ApiOperation(value="删除单个考勤规则")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPlanId", dataType = "String", value = "考勤规则id", paramType = "path")
    })
    Result<Integer> delete(@PathVariable String attendPlanId);

    /**
     * 生成通知(测试)
     * @param attendPlanId 考勤规则id
     * @return
     */
    @ApiOperation(value="发送通知(测试)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPlanId", dataType = "String", value = "考勤规则id", paramType = "path")
    })
    Result<String> sendNotice(@PathVariable String attendPlanId);

    @ApiOperation(value="公众号消息通知(测试)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "taskId", dataType = "String", value = "taskId", paramType = "path")
    })
    Result<String> sendWeChatTempMessage(@PathVariable String taskId);

    /**
     * 定时任务发送通知(测试)
     * @return
     */
    @ApiOperation(value="定时任务发送通知(测试)")
    Result<String> attendPunchRemind();

}
